<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>预约挂号</title>
    <link rel="stylesheet" type="text/css" href="css/aui.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
    <div class="site-name">
      <p>北京114预约挂号平台</p>
    </div>
    <div class="hospital-container">
      <div class="hospital-wrapper">
        <div class="hospital-logo">
          <img src="images/hos_5.png" alt="">
        </div>
        <div class="hospital-info">
          <h4>北京医学科学院肿瘤医院</h4>
          <p>三级甲等</p>
          <p>每日9:00开放第七日号源</p>
        </div>
        <a class="hospital-look" href="tumlook.html">
          <img src="images/look.png" alt="">
          <span>医院详情</span>
        </a>
      </div>
      <div class="search-container">
        <div class="search-wrapper">
          <div class="search-icon">
            <i class="aui-iconfont aui-icon-search"></i>
          </div>
          <div class="search-input">
            <input placeholder="搜索科室" autocomplete="off"/>
          </div>
        </div>
      </div>
    </div>

    <div class="type-container hospital-type-container">
      <div class="type-left">
        <div class="type-left-list">
<!--          <div class="type-left-item type-active">-->
<!--            <i></i>-->
<!--            <a href="javascript:;">头颈肿瘤<input type="hidden" value="1"></a>-->
<!--          </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">胸部肿瘤<input type="hidden" value="2"></a>-->
<!--            </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">腹部及四肢肿瘤<input type="hidden" value="3"></a>-->
<!--            </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">乳腺肿瘤<input type="hidden" value="4"></a>-->
<!--            </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">妇科肿瘤<input type="hidden" value="5"></a>-->
<!--            </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">内科肿瘤化疗<input type="hidden" value="6"></a>-->
<!--            </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">特需门诊<input type="hidden" value="7"></a>-->
<!--            </div>-->
<!--            <div class="type-left-item">-->
<!--                <i></i>-->
<!--                <a href="javascript:;">其他治疗<input type="hidden" value="8"></a>-->
<!--            </div>-->
        </div>
      </div>
      <div class="type-right">
        <div class="type-right-list" id="my_div_1">

        </div>
      </div>
    </div>

</body>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
    $('.type-left-item').click(function () {
      $('.type-left-item').removeClass('type-active');
      $(this).addClass('type-active');
    })
</script>
<script>
    var k_name = "头颈肿瘤";
    $(function () {
        $.ajax({
            type: "post",
            url: "http://guowang.nat300.top/wechat114/kForm/getAll",
            data:"",
            async:false,
            dataType: "json",
            success: function (data) {
                var form = "";
                for (var i=0;i<data.data.length;i++){
                    if (data.data[i].kId == "1"){
                        form += "<div class='type-left-item type-active'>\n" +
                            "                           <i></i>\n" +
                            "                           <a href='javascript:;'>"+data.data[i].kName+"<input type='hidden' value='"+data.data[i].kId+"'></a>\n" +
                            "                       </div>";
                    }else {
                        form += "<div class='type-left-item'>\n" +
                            "                           <i></i>\n" +
                            "                           <a href='javascript:;'>"+data.data[i].kName+"<input type='hidden' value='"+data.data[i].kId+"'></a>\n" +
                            "                       </div>";
                    }
                }
                $(".type-left-list").html(form)
            }
        })
        $.getJSON("http://guowang.nat300.top/wechat114/mForm/getList","id=1",function (data) {
            var str = "";
            var m = data.data;
            for (var i=0;i<m.length;i++){
                str += "<div class='type-right-item'>\n" +
                    "            <a href='yuyue.html?id="+m[i].m_id+"&name="+m[i].m_name+"&k_name="+k_name+"'>"+m[i].m_name+"<input type='hidden' value='"+m[i].m_id+"'></a>\n" +
                    "          </div>";
            }
            $("#my_div_1").html(str)
        })
        $("a").click(function () {
            var id = $(this).children().val();
            k_name = $(this).text();
            $.getJSON("http://guowang.nat300.top/wechat114/mForm/getList","id="+id,function (data) {
                var str = "";
                var m = data.data;
                for (var i=0;i<m.length;i++){
                    str += "<div class='type-right-item'>\n" +
                        "            <a href='yuyue.html?id="+m[i].m_id+"&name="+m[i].m_name+"&k_name="+k_name+"'>"+m[i].m_name+"<input type='hidden' value='"+m[i].m_id+"'></a>\n" +
                        "          </div>";
                }
                $("#my_div_1").html(str)
            })

        })
    })


    $(document).ready(function () {
        var today = new Array('周日', '周一', '周二', '周三', '周四', '周五', '周六');
        var time = new Date();
        /*    time.getYear(); //获取当前年份
            time.getFullYear(); //获取完整的年份(4位,1970-???)
            time.getMonth(); //获取当前月份(0-11,0代表1月)
            time.getDate(); //获取当前日(1-31)
            time.getDay(); //获取当前星期X(0-6,0代表星期天)
            time.getTime(); //获取当前时间(从1970.1.1开始的毫秒数)
            time.getHours(); //获取当前小时数(0-23)
            time.getMinutes(); //获取当前分钟数(0-59)
            time.getSeconds(); //获取当前秒数(0-59)
            time.getMilliseconds(); //获取当前毫秒数(0-999)
            time.toLocaleDateString(); //获取当前日期
            time.toLocaleString( ); //获取日期与时间
            var mytime=time.toLocaleTimeString(); //获取当前时间*/
        var week = today[time.getDay()];

        let s = fun_date(7);

        function fun_date(aa) {
            var date1 = new Date();
            var time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();//time1表示当前时间
            var date2 = new Date(date1);
            date2.setDate(date1.getDate() + aa);
            var time2 = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate();
            return time2;
        }

        $.ajax({
            type: "post",
            url: "http://guowang.nat300.top/wechat114/gform/selectOne",
            data: {"mid": 1, "day":s },
            async: false,
            dataType: "json",
            success: function (data) {
                if (data.data == null) {
                    if (time.getHours() >= 9) {
                        $.ajax({
                            type: "post",
                            url: "http://guowang.nat300.top/wechat114/gform/add",
                            data: {"day": s, "week": week},
                            date: {},
                            dataType: "json",
                            success: function () {

                            }
                        })
                    }
                }
            }
        })
    })
</script>

</html>
